<template>
  <a-modal width="40%" :visible="visible"   @cancel="handleCancel" >
    <span slot="title">
      {{ title }}
    </span>
    <video class="video" ref="video" :src="getImgView(videoUrl)" controls></video>
    <span slot="footer">
      <a-button @click="handleCancel">关闭</a-button>
    </span>
  </a-modal>
</template>

<script>
import { getAction,getFileAccessHttpUrl, deleteAction } from "@/api/manage.js";
  export default {
    name: 'SkVisitModal',
    components: {
    },
    data () {
      return {
        visible:false,
        videoUrl:"",
        title:undefined
      }
    },
    methods: {
      init(data){
        this.title = data.stuName
        this.videoUrl = data.fileUrl;
        this.visible = true;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      handleCancel () {
        // 暂停播放
        this.$refs.video.pause()
        // 重置视频播放进度
        this.$refs.video.currentTime = 0
        this.visible = false;
      },
      // 查看图片
    getImgView(text){
      if(text && text.indexOf(",")>0){
        text = text.substring(0,text.indexOf(","))
      }
      return getFileAccessHttpUrl(text)
    },
    }
  }
</script>
<style scoped>
  .video{
    width:100%;
    height: auto;
  }
</style>